package ace.module.account.core.impl.controller.rest.rpc.ext;

import ace.cmp.core.model.R;
import ace.cmp.security.oauth2.resource.server.core.annotation.PreAuthorizeIsInternalClient;
import ace.module.account.api.model.auth.dto.AuthenticationResult;
import ace.module.account.core.impl.service.authentication.AuthenticationService;
import ace.module.account.sdk.core.feign.impl.IamAuthenticationFeign;
import ace.module.common.api.annotation.ApiRemoteImplementPriority;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Caspar
 */
@Tag(name = "账户认证-RPC-API")
@PreAuthorizeIsInternalClient
@AllArgsConstructor
@RestController
@RequestMapping(IamAuthenticationFeign.PATH)
@ApiRemoteImplementPriority
public class IamAuthenticationRpcController implements IamAuthenticationFeign {
  private final AuthenticationService authenticationService;
  private static final String PATH = "/account/iam-authentication/rpc";
  public static final String URL_AUTHENTICATION = PATH + "/authentication";

  @Operation(summary = "账户认证通用入参方法")
  @Override
  public R<AuthenticationResult> authentication(String input) {
    return authenticationService.authentication(input);
  }
}
